var pageNo = 1; //当前页数
var loading = false; //状态标记
var getPage = function() {
		$.ajax({
			type: "get",
			url: ctx + "/weixin/getUserTask?flag=history&pageNo=" + pageNo + "&pageSize=20&openid="+param().openid,
			success: function(result) {
				result = result.results;
				if(result.length == 0 ){
					$(".weui_panel_bd").html("无数据！");
				}
				if (result.length < 21) {
					$(document.body).destroyInfinite();
					$(".weui-infinite-scroll").hide();
				}
				var tpl = $("#tpl").text();
				var html = juicer(tpl, {
					list: result
				});
				$(".weui_panel_bd").append(html);
				loading = false;
				pageNo++;
			},
			error: function(err) {
				console.error(err);
				$.alert("系统异常！");
			}
		});
	}
	//加载列表
$(document.body).infinite().on("infinite", function() {
	if (loading) return;
	loading = true;
	getPage();
});
$(function() {
	$(document.body).trigger("infinite");
});